<template>
	<u-tabbar :value="value" @change="name => value = name" :fixed="true" :placeholder="true"
		:safeAreaInsetBottom="true">
		<u-tabbar-item text="首页" icon="home"></u-tabbar-item>
		<u-tabbar-item text="预约" icon="bell"></u-tabbar-item>
		<u-tabbar-item text="我的" icon="account"></u-tabbar-item>
	</u-tabbar>
</template>

<script>
	export default {
		name: "footer-tab-bar",
		data() {
			return {
				value: this.$store.state.$tabBarActive,
			};
		},
		watch: {
			value(val) {
				console.log(val)
				this.$store.commit('saveActive',val)
				if (val == 0) return uni.redirectTo({
					url: '/pages/home/home'
				})
				if (val == 1) return uni.redirectTo({
					url: '/pages/subscribe/subscribe'
				})
				if (val == 2) return uni.redirectTo({
					url: '/pages/user/user'
				})
			}
		},
		methods: {}
	}
</script>

<style>

</style>
